package org.batatasframework.support.searchable.result;

import java.util.List;

import org.batatasframework.support.database.sql.field.SelectFragment;
import org.batatasframework.support.database.values.FieldValue;
import org.batatasframework.support.searchable.SearchableType;


public class GroupResultBuffer extends AbstractGroupResultStream<SearchResultHead, GroupResultRow>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 6943874795070209878L;

	public GroupResultBuffer(SelectFragment group) throws Exception {
		super(group);
	}

	@Override
	protected SearchResultHead buildHead(SelectFragment sf) {
		if(groupSelectFragment == sf) return null;
		return new SearchResultHead(sf);
	}

	@Override
	protected GroupResultRow buildGroupRow(List<SearchResultHead> heads, FieldValue value) {
		return new GroupResultRow(heads, value.sourceValue());
	}

	@Override
	public SearchableType getSearchableType() {
		return SearchableType.GROUP;
	}
}
